import { AUTH, ROUTES } from '@/services/api'
import { request, METHOD, removeAuthorization } from '@/utils/request'

export async function tenantLogin(data) {
  return request(AUTH + "/tenant/login", METHOD.POST, data)
}

export async function adminLogin(data) {
  return request(AUTH + "/admin/login", METHOD.POST, data)
}

export async function getRoutesConfig() {
  return request(ROUTES, METHOD.GET)
}

/**
 * 退出登录
 */
export function logout() {
  localStorage.removeItem(process.env.VUE_APP_ROUTES_KEY)
  localStorage.removeItem(process.env.VUE_APP_PERMISSIONS_KEY)
  localStorage.removeItem(process.env.VUE_APP_ROLES_KEY)
  removeAuthorization()
}
export default {
  adminLogin,
  tenantLogin,
  logout,
  getRoutesConfig
}
